package com.example.webcourse.view

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Path
import android.graphics.RectF
import android.util.AttributeSet
import android.view.View

class SectorView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
    @SuppressLint("DrawAllocation")
    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)
        // 创建画笔
        val p =  Paint();
        p.color = Color.BLACK;
        p.style = Paint.Style.STROKE;
        val path = Path()
        path.moveTo(100f,320f)
        path.quadTo(150f,310f,170f,400f)
        canvas.drawPath(path,p)




        // 创建画笔  扇形 x轴为初始方向
//        val p = Paint();
//        p.color = Color.BLACK;
//        val rectF = RectF(60f, 100f, 200f, 240f);
//
//        canvas.drawArc(rectF, 200f, 130f, true, p);
    }
}